pip install plotly pip install cufflinks
Requirement already satisfied: plotly in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (4.14.3)
Requirement already satisfied: pip in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (21.1.2)
Collecting install
Using cached install-1.3.4-py3-none-any.whl (3.1 kB)
Collecting cufflinks
Using cached cufflinks-0.17.3.tar.gz (81 kB)
Requirement already satisfied: six in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from plotly) (1.16.0)
Requirement already satisfied: retrying>=1.3.3 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from plotly) (1.3.3)
Requirement already satisfied: numpy>=1.9.2 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from cufflinks) (1.20.3)
Requirement already satisfied: pandas>=0.19.2 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from cufflinks) (1.2.4)
Collecting colorlover>=0.2.1
Using cached colorlover-0.3.0-py3-none-any.whl (8.9 kB)
Requirement already satisfied: setuptools>=34.4.1 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from cufflinks) (57.0.0)
Requirement already satisfied: ipython>=5.3.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from cufflinks) (7.24.0)
Requirement already satisfied: ipywidgets>=7.0.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from cufflinks) (7.6.3)
Requirement already satisfied: pygments in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipython>=5.3.0->cufflinks) (2.9.0)
Requirement already satisfied: decorator in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipython>=5.3.0->cufflinks) (5.0.9)
Requirement already satisfied: jedi>=0.16 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipython>=5.3.0->cufflinks) (0.18.0)
Requirement already satisfied: pickleshare in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipython>=5.3.0->cufflinks) (0.7.5)
Requirement already satisfied: backcall in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipython>=5.3.0->cufflinks) (0.2.0)
Requirement already satisfied: matplotlib-inline in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipython>=5.3.0->cufflinks) (0.1.2)
Requirement already satisfied: colorama in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipython>=5.3.0->cufflinks) (0.4.4)
Requirement already satisfied: traitlets>=4.2 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipython>=5.3.0->cufflinks) (5.0.5)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipython>=5.3.0->cufflinks) (3.0.18)
Requirement already satisfied: jupyterlab-widgets>=1.0.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipywidgets>=7.0.0->cufflinks) (1.0.0)
Requirement already satisfied: ipykernel>=4.5.1 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipywidgets>=7.0.0->cufflinks) (5.5.5)
Requirement already satisfied: widgetsnbextension~=3.5.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipywidgets>=7.0.0->cufflinks) (3.5.1)
Requirement already satisfied: nbformat>=4.2.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipywidgets>=7.0.0->cufflinks) (5.1.3)
Requirement already satisfied: tornado>=4.2 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipykernel>=4.5.1->ipywidgets>=7.0.0->cufflinks) (6.1)
Requirement already satisfied: jupyter-client in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from ipykernel>=4.5.1->ipywidgets>=7.0.0->cufflinks) (6.1.12)
Requirement already satisfied: parso<0.9.0,>=0.8.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from jedi>=0.16->ipython>=5.3.0->cufflinks) (0.8.2)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbformat>=4.2.0->ipywidgets>=7.0.0->cufflinks) (3.2.0)
Requirement already satisfied: jupyter-core in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbformat>=4.2.0->ipywidgets>=7.0.0->cufflinks) (4.7.1)
Requirement already satisfied: ipython-genutils in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbformat>=4.2.0->ipywidgets>=7.0.0->cufflinks) (0.2.0)
Requirement already satisfied: pyrsistent>=0.14.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets>=7.0.0->cufflinks) (0.17.3)
Requirement already satisfied: attrs>=17.4.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets>=7.0.0->cufflinks) (21.2.0)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from pandas>=0.19.2->cufflinks) (2.8.1)
Requirement already satisfied: pytz>=2017.3 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from pandas>=0.19.2->cufflinks) (2021.1)
Requirement already satisfied: wcwidth in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.3.0->cufflinks) (0.2.5)
Requirement already satisfied: notebook>=4.4.1 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (6.4.0)
Requirement already satisfied: Send2Trash>=1.5.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (1.5.0)
Requirement already satisfied: jinja2 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (3.0.1)
Requirement already satisfied: nbconvert in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (6.0.7)
Requirement already satisfied: terminado>=0.8.3 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (0.10.0)
Requirement already satisfied: prometheus-client in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (0.10.1)
Requirement already satisfied: pyzmq>=17 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (22.1.0)
Requirement already satisfied: argon2-cffi in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (20.1.0)
Requirement already satisfied: pywin32>=1.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from jupyter-core->nbformat>=4.2.0->ipywidgets>=7.0.0->cufflinks) (301)
Requirement already satisfied: pywinpty>=1.1.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from terminado>=0.8.3->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (1.1.1)
Requirement already satisfied: cffi>=1.0.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (1.14.5)
Requirement already satisfied: pycparser in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (2.20)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (2.0.1)
Requirement already satisfied: testpath in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (0.5.0)
Requirement already satisfied: mistune<2,>=0.8.1 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (0.8.4)
Requirement already satisfied: pandocfilters>=1.4.1 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (1.4.3)
Requirement already satisfied: defusedxml in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (0.7.1)
Requirement already satisfied: jupyterlab-pygments in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (0.1.2)
Requirement already satisfied: bleach in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (3.3.0)
Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (0.5.3)
Requirement already satisfied: entrypoints>=0.2.2 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (0.3)
Requirement already satisfied: async-generator in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (1.10)
Requirement already satisfied: nest-asyncio in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (1.5.1)
Requirement already satisfied: webencodings in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (0.5.1)
Requirement already satisfied: packaging in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (20.9)
Requirement already satisfied: pyparsing>=2.0.2 in c:\users\user\pycharmprojects\wordcount\venv\lib\site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->cufflinks) (2.4.7)
Using legacy 'setup.py install' for cufflinks, since package 'wheel' is not installed.
Installing collected packages: colorlover, install, cufflinks
Running setup.py install for cufflinks: started
Running setup.py install for cufflinks: finished with status 'done'
Successfully installed colorlover-0.3.0 cufflinks-0.17.3 install-1.3.4
Note: you may need to restart the kernel to use updated packages.
import pandas as pd
import numpy as np
import chart_studio.plotly as py
import cufflinks as cf
import seaborn as sns
import plotly.express as px
%matplotlib inline
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
init_notebook_mode(connected=True)
cf.go_offline()
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
jntOne = pd.read_table('jnt-output-1.txt', delimiter = ":", header=None)
jntOne.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfOne = pd.DataFrame(jntOne)
# change column data type from string to int
jntOne['Count'] = pd.to_numeric(dfOne['Count'])
jntOne
| Word | Count | |
|---|---|---|
| 0 | the | 29 |
| 1 | malaysian | 1 |
| 2 | communications | 1 |
| 3 | and | 6 |
| 4 | multimedia | 1 |
| ... | ... | ... |
| 123 | choosing | 1 |
| 124 | service | 2 |
| 125 | delivery | 1 |
| 126 | purchases. | 1 |
| 127 | if:1\r\nthere:1\r\nloss:1\r\nitems,:1\r\nconta... | 1 |
128 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-2 using pandas
jntTwo = pd.read_table('jnt-output-2.txt', delimiter = ":", header=None)
jntTwo.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfTwo = pd.DataFrame(jntTwo)
# change column data type from string to int
jntTwo['Count'] = pd.to_numeric(dfTwo['Count'])
jntTwo
| Word | Count | |
|---|---|---|
| 0 | over | 1 |
| 1 | the | 12 |
| 2 | past | 1 |
| 3 | few | 2 |
| 4 | weeks, | 1 |
| ... | ... | ... |
| 189 | express | 1 |
| 190 | deserve | 1 |
| 191 | second | 1 |
| 192 | chance | 1 |
| 193 | malaysians? | 1 |
194 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-3 using pandas
jntThree = pd.read_table('jnt-output-3.txt', delimiter = ":", header=None)
jntThree.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfThree = pd.DataFrame(jntThree)
# change column data type from string to int
jntThree['Count'] = pd.to_numeric(dfThree['Count'])
jntThree
| Word | Count | |
|---|---|---|
| 0 | the | 38 |
| 1 | up | 5 |
| 2 | and | 34 |
| 3 | coming | 2 |
| 4 | logistics | 5 |
| ... | ... | ... |
| 449 | deals, | 1 |
| 450 | promos | 1 |
| 451 | and, | 1 |
| 452 | course, | 1 |
| 453 | shipping!� | 1 |
454 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
#JNT WORD COUNT FOR ARCTICLE 1
px.histogram(jntOne.iloc[0:14], x='Word', y='Count', labels={'x': 'Word', 'y': 'Count'}, title='JNT Word Count - MCMC Issues Warning To J&T Express Over Video Showing Staff Mishandling Parcel')
#JNT WORD COUNT FOR ARCTICLE 2
px.histogram(jntTwo.iloc[0:14], x='Word', y='Count', labels={'x': 'Word', 'y': 'Count'}, title='JNT Word Count - J&T Express Experience Decline In Ordered Items Following Bad Publicity')
#JNT WORD COUNT FOR ARCTICLE 3
px.histogram(jntTwo.iloc[0:14], x='Word', y='Count', labels={'x': 'Word', 'y': 'Count'}, title='JNT Word Count - J&T Express anticipates promising 11.11 big sale')
import pandas as pd
import plotly.graph_objects as go
from plotly.offline import iplot
#Merge the table
jntOT = pd.merge(jntOne, jntTwo, on='Word', how= 'inner')
jnt = pd.merge(jntOT, jntThree, on= 'Word')
#rename the column
jnt.rename(columns = {'Count_x':'jnt-article-1', 'Count_y':'jnt-article-2',
'Count':'jnt-article-3'}, inplace = True)
px.bar(jnt, x='Word', y=["jnt-article-1", "jnt-article-2", "jnt-article-3"], title='JNT Word Count (INNER JOIN)')
To print to HTML
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
jntSW1 = pd.read_table('jnt-stopwords-1.txt', delimiter = ":", header=None)
jntSW1.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW1 = pd.DataFrame(jntSW1)
# change column data type from string to int
jntSW1['Count'] = pd.to_numeric(dfSW1['Count'])
jntSW1
| Word | Count | |
|---|---|---|
| 0 | the | 29 |
| 1 | and | 6 |
| 2 | has | 3 |
| 3 | taken | 1 |
| 4 | of | 7 |
| 5 | that | 6 |
| 6 | showed | 1 |
| 7 | a | 10 |
| 8 | in | 6 |
| 9 | with | 5 |
| 10 | on | 4 |
| 11 | it | 1 |
| 12 | seriously | 1 |
| 13 | to | 10 |
| 14 | an | 1 |
| 15 | what | 1 |
| 16 | while | 1 |
| 17 | did | 1 |
| 18 | not | 4 |
| 19 | name | 1 |
| 20 | following | 1 |
| 21 | over | 2 |
| 22 | was | 2 |
| 23 | according | 1 |
| 24 | due | 1 |
| 25 | among | 1 |
| 26 | some | 1 |
| 27 | which | 1 |
| 28 | for | 3 |
| 29 | their | 3 |
| 30 | who | 1 |
| 31 | were | 1 |
| 32 | also | 2 |
| 33 | said | 1 |
| 34 | can | 1 |
| 35 | be | 3 |
| 36 | both | 2 |
| 37 | under | 2 |
| 38 | act | 1 |
| 39 | must | 1 |
| 40 | by | 1 |
| 41 | especially | 1 |
| 42 | could | 1 |
| 43 | more | 1 |
| 44 | than | 1 |
| 45 | or | 3 |
| 46 | three | 1 |
| 47 | if | 2 |
| 48 | they | 2 |
| 49 | are | 3 |
| 50 | found | 1 |
| 51 | have | 1 |
| 52 | any | 3 |
| 53 | before | 1 |
| 54 | there | 1 |
| 55 | is | 1 |
| 56 | may | 1 |
| 57 | via | 1 |
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
jntSW2 = pd.read_table('jnt-stopwords-2.txt', delimiter = ":", header=None)
jntSW2.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW2 = pd.DataFrame(jntSW2)
# change column data type from string to int
jntSW2['Count'] = pd.to_numeric(dfSW2['Count'])
jntSW2
| Word | Count | |
|---|---|---|
| 0 | over | 1 |
| 1 | the | 12 |
| 2 | past | 1 |
| 3 | few | 2 |
| 4 | there | 2 |
| ... | ... | ... |
| 69 | could | 1 |
| 70 | do | 1 |
| 71 | you | 1 |
| 72 | think | 1 |
| 73 | second | 1 |
74 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
jntSW3 = pd.read_table('jnt-stopwords-3.txt', delimiter = ":", header=None)
jntSW3.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW3 = pd.DataFrame(jntSW3)
# change column data type from string to int
jntSW3['Count'] = pd.to_numeric(dfSW3['Count'])
jntSW3
| Word | Count | |
|---|---|---|
| 0 | the | 38 |
| 1 | up | 5 |
| 2 | and | 34 |
| 3 | a | 21 |
| 4 | in | 21 |
| ... | ... | ... |
| 92 | help | 1 |
| 93 | together | 1 |
| 94 | can | 1 |
| 95 | best | 1 |
| 96 | us | 1 |
97 rows × 2 columns
import pandas as pd
import plotly.graph_objects as go
from plotly.offline import iplot
#Merge the table
jntSWOT = pd.merge(jntSW1, jntSW2, on='Word', how= 'inner')
jntSW = pd.merge(jntSWOT, jntSW3, on= 'Word')
#rename the column
jntSW.rename(columns = {'Count_x':'jnt-article-1', 'Count_y':'jnt-article-2',
'Count':'jnt-article-3'}, inplace = True)
px.bar(jntSW, x='Word', y=["jnt-article-1", "jnt-article-2", "jnt-article-3"], title='JNT Stopwords Count (INNER JOIN)')
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
clOne = pd.read_table('citylink-output-1.txt', delimiter = ":", header=None)
clOne.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfOne = pd.DataFrame(clOne)
# change column data type from string to int
clOne['Count'] = pd.to_numeric(dfOne['Count'])
clOne
| Word | Count | |
|---|---|---|
| 0 | city-link | 12 |
| 1 | express | 6 |
| 2 | maintains | 1 |
| 3 | its | 3 |
| 4 | fast | 1 |
| ... | ... | ... |
| 189 | learning | 1 |
| 190 | techniques | 1 |
| 191 | economical | 1 |
| 192 | safe | 1 |
| 193 | driving. | 1 |
194 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-2 using pandas
clTwo = pd.read_table('citylink-output-2.txt', delimiter = ":", header=None)
clTwo.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfTwo = pd.DataFrame(clTwo)
# change column data type from string to int
clTwo['Count'] = pd.to_numeric(dfTwo['Count'])
clTwo
| Word | Count | |
|---|---|---|
| 0 | city-link | 2 |
| 1 | express | 1 |
| 2 | (m) | 1 |
| 3 | sdn | 1 |
| 4 | bhd, | 1 |
| ... | ... | ... |
| 268 | 4.9ha | 1 |
| 269 | features | 1 |
| 270 | fully-automated | 1 |
| 271 | sorting | 1 |
| 272 | system. | 1 |
273 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-3 using pandas
clThree = pd.read_table('citylink-output-3.txt', delimiter = ":", header=None)
clThree.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfThree = pd.DataFrame(clThree)
# change column data type from string to int
clThree['Count'] = pd.to_numeric(dfThree['Count'])
clThree
| Word | Count | |
|---|---|---|
| 0 | isuzu | 6 |
| 1 | malaysia | 4 |
| 2 | recently | 2 |
| 3 | delivered | 2 |
| 4 | a | 6 |
| ... | ... | ... |
| 213 | features | 1 |
| 214 | achieving | 1 |
| 215 | economic | 1 |
| 216 | safety | 1 |
| 217 | driving. | 1 |
218 rows × 2 columns
import pandas as pd
import plotly.graph_objects as go
from plotly.offline import iplot
#Merge the table
clOT = pd.merge(clOne, clTwo, on='Word', how= 'inner')
cl = pd.merge(clOT, clThree, on= 'Word', how= 'inner')
#rename the column
cl.rename(columns = {'Count_x':'citylink-article-1', 'Count_y':'citylink-article-2',
'Count':'citylink-article-3'}, inplace = True)
px.bar(cl, x='Word', y=["citylink-article-1", "citylink-article-2", "citylink-article-3"], title='CityLink Word Count (INNER JOIN)')
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
clSW1 = pd.read_table('citylink-stopwords-1.txt', delimiter = ":", header=None)
clSW1.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW1 = pd.DataFrame(clSW1)
# change column data type from string to int
clSW1['Count'] = pd.to_numeric(dfSW1['Count'])
clSW1
| Word | Count | |
|---|---|---|
| 0 | its | 3 |
| 1 | with | 3 |
| 2 | an | 2 |
| 3 | was | 5 |
| 4 | recently | 2 |
| 5 | at | 4 |
| 6 | the | 13 |
| 7 | up | 1 |
| 8 | in | 9 |
| 9 | to | 10 |
| 10 | of | 9 |
| 11 | line | 1 |
| 12 | has | 1 |
| 13 | been | 1 |
| 14 | as | 4 |
| 15 | seen | 1 |
| 16 | and | 8 |
| 17 | between | 1 |
| 18 | both | 1 |
| 19 | since | 1 |
| 20 | first | 1 |
| 21 | made | 1 |
| 22 | will | 2 |
| 23 | further | 2 |
| 24 | same | 1 |
| 25 | these | 1 |
| 26 | were | 1 |
| 27 | specifically | 1 |
| 28 | various | 1 |
| 29 | which | 1 |
| 30 | before | 1 |
| 31 | being | 1 |
| 32 | out | 1 |
| 33 | all | 1 |
| 34 | during | 1 |
| 35 | his | 2 |
| 36 | took | 1 |
| 37 | for | 3 |
| 38 | their | 4 |
| 39 | that | 1 |
| 40 | this | 1 |
| 41 | recent | 1 |
| 42 | a | 1 |
| 43 | also | 1 |
| 44 | on | 1 |
| 45 | are | 1 |
| 46 | well | 2 |
| 47 | by | 1 |
import plotly.express as px
import pandas as pd
import numpy as np
# read article-2 using pandas
clSW2 = pd.read_table('citylink-stopwords-2.txt', delimiter = ":", header=None)
clSW2.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW2 = pd.DataFrame(clSW2)
# change column data type from string to int
clSW2['Count'] = pd.to_numeric(dfSW2['Count'])
clSW2
| Word | Count | |
|---|---|---|
| 0 | which | 2 |
| 1 | has | 2 |
| 2 | an | 1 |
| 3 | of | 7 |
| 4 | more | 3 |
| ... | ... | ... |
| 71 | going | 1 |
| 72 | any | 1 |
| 73 | one | 1 |
| 74 | particular | 1 |
| 75 | least | 1 |
76 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-3 using pandas
clSW3 = pd.read_table('citylink-stopwords-3.txt', delimiter = ":", header=None)
clSW3.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW3 = pd.DataFrame(clSW3)
# change column data type from string to int
clSW3['Count'] = pd.to_numeric(dfSW3['Count'])
clSW3
| Word | Count | |
|---|---|---|
| 0 | recently | 2 |
| 1 | a | 6 |
| 2 | of | 16 |
| 3 | their | 4 |
| 4 | to | 8 |
| 5 | during | 1 |
| 6 | an | 2 |
| 7 | at | 1 |
| 8 | in | 6 |
| 9 | the | 20 |
| 10 | eight | 1 |
| 11 | and | 16 |
| 12 | five | 1 |
| 13 | recent | 1 |
| 14 | is | 2 |
| 15 | between | 1 |
| 16 | both | 2 |
| 17 | since | 1 |
| 18 | its | 3 |
| 19 | first | 2 |
| 20 | made | 1 |
| 21 | back | 1 |
| 22 | has | 1 |
| 23 | further | 1 |
| 24 | line | 1 |
| 25 | with | 2 |
| 26 | throughout | 1 |
| 27 | while | 2 |
| 28 | also | 2 |
| 29 | saw | 1 |
| 30 | as | 1 |
| 31 | part | 1 |
| 32 | these | 2 |
| 33 | are | 2 |
| 34 | for | 6 |
| 35 | which | 1 |
| 36 | makes | 1 |
| 37 | it | 1 |
| 38 | his | 1 |
| 39 | he | 1 |
| 40 | that | 1 |
| 41 | will | 2 |
| 42 | be | 1 |
| 43 | overall | 1 |
| 44 | was | 1 |
| 45 | after | 1 |
| 46 | were | 1 |
| 47 | on | 2 |
| 48 | around | 1 |
| 49 | due | 1 |
| 50 | out | 1 |
import pandas as pd
import plotly.graph_objects as go
from plotly.offline import iplot
#Merge the table
clSWOT = pd.merge(clSW1, clSW2, on='Word', how= 'inner')
clSW = pd.merge(clSWOT, clSW3, on= 'Word')
#rename the column
clSW.rename(columns = {'Count_x':'citylink-article-1', 'Count_y':'citylink-article-2',
'Count':'citylink-article-3'}, inplace = True)
px.bar(clSW, x='Word', y=["citylink-article-1", "citylink-article-2", "citylink-article-3"], title='CityLink Stopwords Count (INNER JOIN)')
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
dhlOne = pd.read_table('dhl-output-1.txt', delimiter = ":", header=None)
dhlOne.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfOne = pd.DataFrame(dhlOne)
# change column data type from string to int
dhlOne['Count'] = pd.to_numeric(dfOne['Count'])
dhlOne
| Word | Count | |
|---|---|---|
| 0 | dhl | 10 |
| 1 | express | 11 |
| 2 | is | 12 |
| 3 | the | 63 |
| 4 | delivery | 7 |
| ... | ... | ... |
| 635 | markets,� | 1 |
| 636 | announced | 1 |
| 637 | media | 1 |
| 638 | statement | 1 |
| 639 | wednesday. | 1 |
640 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-2 using pandas
dhlTwo = pd.read_table('dhl-output-2.txt', delimiter = ":", header=None)
dhlTwo.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfTwo = pd.DataFrame(dhlTwo)
# change column data type from string to int
dhlTwo['Count'] = pd.to_numeric(dfTwo['Count'])
dhlTwo
| Word | Count | |
|---|---|---|
| 0 | although | 1 |
| 1 | globalisation | 4 |
| 2 | has | 16 |
| 3 | been | 5 |
| 4 | hit | 1 |
| ... | ... | ... |
| 632 | markets,� | 1 |
| 633 | announced | 1 |
| 634 | media | 1 |
| 635 | statement | 1 |
| 636 | wednesday. | 1 |
637 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-3 using pandas
dhlThree = pd.read_table('dhl-output-3.txt', delimiter = ":", header=None)
dhlThree.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfThree = pd.DataFrame(dhlThree)
# change column data type from string to int
dhlThree['Count'] = pd.to_numeric(dfThree['Count'])
dhlThree
| Word | Count | |
|---|---|---|
| 0 | companies | 2 |
| 1 | to | 14 |
| 2 | collaborate | 1 |
| 3 | on | 2 |
| 4 | the | 23 |
| ... | ... | ... |
| 315 | methods | 1 |
| 316 | like | 1 |
| 317 | trucks | 1 |
| 318 | or | 1 |
| 319 | boats. | 1 |
320 rows × 2 columns
import pandas as pd
import plotly.graph_objects as go
from plotly.offline import iplot
#Merge the table
dhlOT = pd.merge(dhlOne, dhlTwo, on='Word', how= 'inner')
dhl = pd.merge(dhlOT, dhlThree, on= 'Word')
#rename the column
dhl.rename(columns = {'Count_x':'dhl-article-1', 'Count_y':'dhl-article-2',
'Count':'dhl-article-3'}, inplace = True)
px.bar(dhl, x='Word', y=["dhl-article-1", "dhl-article-2", "dhl-article-3"], title='DHL Word Count (INNER JOIN)')
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
dhlSW1 = pd.read_table('dhl-stopwords-1.txt', delimiter = ":", header=None)
dhlSW1.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW1 = pd.DataFrame(dhlSW1)
# change column data type from string to int
dhlSW1['Count'] = pd.to_numeric(dfSW1['Count'])
dhlSW1
| Word | Count | |
|---|---|---|
| 0 | is | 12 |
| 1 | the | 63 |
| 2 | of | 36 |
| 3 | which | 3 |
| 4 | on | 5 |
| ... | ... | ... |
| 129 | still | 1 |
| 130 | possible | 1 |
| 131 | always | 1 |
| 132 | eight | 1 |
| 133 | first | 1 |
134 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-2 using pandas
dhlSW2 = pd.read_table('dhl-stopwords-2.txt', delimiter = ":", header=None)
dhlSW2.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW2 = pd.DataFrame(dhlSW2)
# change column data type from string to int
dhlSW2['Count'] = pd.to_numeric(dfSW2['Count'])
dhlSW2
| Word | Count | |
|---|---|---|
| 0 | although | 1 |
| 1 | has | 16 |
| 2 | been | 5 |
| 3 | because | 1 |
| 4 | of | 35 |
| ... | ... | ... |
| 129 | still | 1 |
| 130 | possible | 1 |
| 131 | always | 1 |
| 132 | eight | 1 |
| 133 | first | 1 |
134 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-3 using pandas
dhlSW3 = pd.read_table('dhl-stopwords-3.txt', delimiter = ":", header=None)
dhlSW3.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW3 = pd.DataFrame(dhlSW3)
# change column data type from string to int
dhlSW3['Count'] = pd.to_numeric(dfSW3['Count'])
dhlSW3
| Word | Count | |
|---|---|---|
| 0 | to | 14 |
| 1 | on | 2 |
| 2 | the | 23 |
| 3 | of | 17 |
| 4 | for | 7 |
| ... | ... | ... |
| 57 | regardless | 1 |
| 58 | beyond | 1 |
| 59 | much | 1 |
| 60 | like | 1 |
| 61 | or | 1 |
62 rows × 2 columns
import pandas as pd
import plotly.graph_objects as go
from plotly.offline import iplot
#Merge the table
dhlSWOT = pd.merge(dhlSW1, dhlSW2, on='Word', how= 'inner')
dhlSW = pd.merge(dhlSWOT, dhlSW3, on= 'Word')
#rename the column
dhlSW.rename(columns = {'Count_x':'dhl-article-1', 'Count_y':'dhl-article-2',
'Count':'dhl-article-3'}, inplace = True)
px.bar(dhlSW, x='Word', y=["dhl-article-1", "dhl-article-2", "dhl-article-3"], title='DHL Stopwords (INNER JOIN)')
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
plOne = pd.read_table('poslaju-output-1.txt', delimiter = ":", header=None)
plOne.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfOne = pd.DataFrame(plOne)
# change column data type from string to int
plOne['Count'] = pd.to_numeric(dfOne['Count'])
plOne
| Word | Count | |
|---|---|---|
| 0 | you | 3 |
| 1 | can | 5 |
| 2 | grab | 1 |
| 3 | a | 31 |
| 4 | burger | 1 |
| ... | ... | ... |
| 574 | (see | 1 |
| 575 | stories | 1 |
| 576 | pages | 1 |
| 577 | 36 | 1 |
| 578 | 37). | 1 |
579 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-2 using pandas
plTwo = pd.read_table('poslaju-output-2.txt', delimiter = ":", header=None)
plTwo.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfTwo = pd.DataFrame(plTwo)
# change column data type from string to int
plTwo['Count'] = pd.to_numeric(dfTwo['Count'])
plTwo
| Word | Count | |
|---|---|---|
| 0 | recently, | 1 |
| 1 | i | 7 |
| 2 | ordered | 1 |
| 3 | an | 2 |
| 4 | item | 1 |
| ... | ... | ... |
| 156 | work | 1 |
| 157 | make | 1 |
| 158 | malaysia | 1 |
| 159 | better | 1 |
| 160 | place. | 1 |
161 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-3 using pandas
plThree = pd.read_table('poslaju-output-3.txt', delimiter = ":", header=None)
plThree.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfThree = pd.DataFrame(plThree)
# change column data type from string to int
plThree['Count'] = pd.to_numeric(dfThree['Count'])
plThree
| Word | Count | |
|---|---|---|
| 0 | in | 5 |
| 1 | a | 6 |
| 2 | press | 1 |
| 3 | statement | 1 |
| 4 | by | 2 |
| ... | ... | ... |
| 187 | many. | 1 |
| 188 | not | 1 |
| 189 | excluded | 1 |
| 190 | from | 1 |
| 191 | crisis. | 1 |
192 rows × 2 columns
import pandas as pd
import plotly.graph_objects as go
from plotly.offline import iplot
#Merge the table
plOT = pd.merge(plOne, plTwo, on='Word', how= 'inner')
pl = pd.merge(plOT, plThree, on= 'Word')
#rename the column
pl.rename(columns = {'Count_x':'poslaju-article-1', 'Count_y':'poslaju-article-2',
'Count':'poslaju-article-3'}, inplace = True)
px.bar(pl, x='Word', y=["poslaju-article-1", "poslaju-article-2", "poslaju-article-3"], title='Pos Laju Word Count (INNER JOIN)')
import plotly.express as px
import pandas as pd
import numpy as np
# read article-1 using pandas
plSW1 = pd.read_table('poslaju-stopwords-1.txt', delimiter = ":", header=None)
plSW1.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW1 = pd.DataFrame(plSW1)
# change column data type from string to int
plSW1['Count'] = pd.to_numeric(dfSW1['Count'])
plSW1
| Word | Count | |
|---|---|---|
| 0 | on | 3 |
| 1 | its | 14 |
| 2 | recent | 1 |
| 3 | of | 14 |
| 4 | the | 23 |
| ... | ... | ... |
| 59 | resulted | 1 |
| 60 | overall | 1 |
| 61 | such | 1 |
| 62 | through | 1 |
| 63 | research | 1 |
64 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-2 using pandas
plSW2 = pd.read_table('poslaju-stopwords-2.txt', delimiter = ":", header=None)
plSW2.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW2 = pd.DataFrame(plSW2)
# change column data type from string to int
plSW2['Count'] = pd.to_numeric(dfSW2['Count'])
plSW2
| Word | Count | |
|---|---|---|
| 0 | i | 7 |
| 1 | an | 2 |
| 2 | which | 1 |
| 3 | was | 2 |
| 4 | to | 13 |
| ... | ... | ... |
| 62 | more | 1 |
| 63 | into | 1 |
| 64 | our | 1 |
| 65 | make | 1 |
| 66 | better | 1 |
67 rows × 2 columns
import plotly.express as px
import pandas as pd
import numpy as np
# read article-3 using pandas
plSW3 = pd.read_table('poslaju-stopwords-3.txt', delimiter = ":", header=None)
plSW3.columns = ['Word','Count']
# convert to 2d data structure using pandas
dfSW3 = pd.DataFrame(plSW3)
# change column data type from string to int
plSW3['Count'] = pd.to_numeric(dfSW3['Count'])
plSW3
| Word | Count | |
|---|---|---|
| 0 | said | 7 |
| 1 | while | 3 |
| 2 | there | 1 |
| 3 | is | 9 |
| 4 | an | 3 |
| ... | ... | ... |
| 69 | he | 1 |
| 70 | be | 2 |
| 71 | another | 1 |
| 72 | two | 1 |
| 73 | may | 2 |
74 rows × 2 columns
import pandas as pd
import plotly.graph_objects as go
from plotly.offline import iplot
#Merge the table
plSWOT = pd.merge(plSW1, plSW2, on='Word', how= 'inner')
plSW = pd.merge(plSWOT, plSW3, on= 'Word')
#rename the column
plSW.rename(columns = {'Count_x':'poslaju-article-1', 'Count_y':'poslaju-article-2',
'Count':'poslaju-article-3'}, inplace = True)
px.bar(plSW, x='Word', y=["poslaju-article-1", "poslaju-article-2", "poslaju-article-3"], title='Pos Laju Stopwords (INNER JOIN)')